<?php

use think\migration\Migrator;
use Phinx\Db\Adapter\MysqlAdapter;

class CreateWebSocketTable extends Migrator
{
    /**
     * Migrate Up.
     */
    public function up()
    {
        $this->table('web_socket', ['comment' => 'WebSocket表', 'id' => 'id', 'primary_key' => ['id']])
            ->addColumn('uid', 'string', ['limit' => 32, 'default' => '', 'comment' => '用户id'])
            ->addColumn('fd', 'string', ['limit' => 32, 'default' => '', 'comment' => 'fd'])
            ->addColumn('action', 'string', ['limit' => 32, 'default' => '', 'comment' => '操作'])
            ->addColumn('remark', 'string', ['limit' => 250, 'default' => '', 'comment' => '备注'])
            ->addTimestamps()
            ->addIndex('fd')
            ->addIndex('uid')
            ->create();
    }

    /**
     * Migrate Down.
     */
    public function down()
    {
        $this->dropTable('web_socket');
    }
}
